import javax.swing.table.DefaultTableModel;


public class DimensionInput extends LabelInput {

	private Node node;
	private Representation repr;
	
	public DimensionInput(Representation repr, Node node){
		this.node = node;
		this.repr = repr;
		setModel(new DefaultTableModel(1,1));
		setValueAt(""+ repr.getDimension(node), 0, 0);
		point = node.getLabelPoint();
		init();
	}
	
	@Override
	protected void write(){
		int dim = 0;
		try{
			dim = Integer.parseInt((String) getValueAt(0,0));
		} catch (NumberFormatException e){
		}
		repr.setDimension(node, dim);
		QuiverFrame.getInstance().getActivePanel().repaint();
	}
}
